//
//  PlayerView.m
//  MP3Player
//
//  Created by kci yoo on 8/15/11.
//  Copyright 2011 Daum Communications. All rights reserved.
//

#import "PlayerView.h"

@implementation PlayerView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
 
        
        btnPlay = [[UIButton alloc] initWithFrame:CGRectMake(120, 0, 100, 50)];
        [self addSubview:btnPlay];
        [btnPlay setTitle:@"재생" forState:UIControlStateNormal];
        
        [btnPlay setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        [btnPlay setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
        
        
        btnPrev = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
        [self addSubview:btnPrev];
        
        [btnPrev setTitle:@"이전" forState:UIControlStateNormal];
        
        [btnPrev setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        [btnPrev setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];

       // btnPrev.backgroundColor = [UIColor redColor];
        
        btnNext = [[UIButton alloc] initWithFrame:CGRectMake(230, 0, 100, 50)];
        [btnNext setTitle:@"다음" forState:UIControlStateNormal];
        [btnNext setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        [btnNext setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];

        [self addSubview:btnNext];
        
        //btnNext.backgroundColor = [UIColor redColor];
        NSLog(@"btnPlay %@",btnPlay);
        
        progressBar = [[UISlider alloc] initWithFrame:CGRectMake(10, 40, 300, 50)];
        [self addSubview:progressBar];
        
        CGRect f = progressBar.frame;
        
        lblCurrentTime = [[UILabel alloc] initWithFrame:CGRectMake(f.origin.x, f.origin.y + f.size.height, 50, 30)];
        lblCurrentTime.textAlignment = UITextAlignmentLeft;
        lblCurrentTime.text = @"0:00";
        lblCurrentTime.textColor = [UIColor colorWithRed:0/255.0 green:222.0/255.0 blue:0 alpha:1];
        [self addSubview:lblCurrentTime];
        
        lblLeftTime = [[UILabel alloc] initWithFrame:CGRectMake(f.origin.x + f.size.width - 50, f.origin.y + f.size.height, 50, 30)];
        lblLeftTime.textAlignment = UITextAlignmentRight;
        lblLeftTime.text = @"0:00";
        lblLeftTime.textColor = [UIColor colorWithRed:0/255.0 green:222.0/255.0 blue:0 alpha:1];
        [self addSubview:lblLeftTime];
    }
    return self;
}
-(void)setBtnPlay:(UIButton *) btn
{
    btnPlay = btn;
}
-(UIButton *) btnPlay
{
    return btnPlay;
}
-(UIButton *) btnPrev
{
    return btnPrev;
}
-(UIButton *) btnNext
{
    return btnNext;
}

- (UISlider *)progressBar
{
    return progressBar;
}

- (UILabel *)lblLeftTime
{
    return lblLeftTime;
}

- (UILabel *)lblCurrentTime
{
    return lblCurrentTime;
}

- (void)dealloc {
    [btnNext release];
    [btnPlay release];
    [btnPrev release];
    [progressBar release];
    [super dealloc];
    [lblLeftTime release];
    [lblCurrentTime release];
}

@end
